//package com.candy.utils;
//
//
//import org.springframework.web.bind.annotation.ControllerAdvice;
//import org.springframework.web.bind.annotation.ExceptionHandler;
//import org.springframework.web.multipart.MaxUploadSizeExceededException;
//
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//import java.io.PrintWriter;
//
///**
// * 处理图片上传时大小超出范围
// */
//@ControllerAdvice
//public class FileUploadExceptionHandler {
//
//    @ExceptionHandler(MaxUploadSizeExceededException.class)
//    public void uploadException(MaxUploadSizeExceededException e, HttpServletResponse response) throws IOException {
//        response.setContentType("text/html;charset=utf-8");
//        PrintWriter out =response.getWriter();
//        out.write("上传文件大小超出限制");
//        out.flush();
//        out.close();
//    }
//}